{% extends 'layout.html' %}

{% block title %}Messages{% endblock %}

{% block content %}
  <ul class="messages">
    {% for message in messages %}
      <li class="message">{{ message.message }}</li>
    {% endfor %}
  </ul>
  <form action="/messages" method="post" id="message-form">
    <textarea placeholder="Insert a message" name="message"
      onkeydown="if (event.keyCode == 13) document.getElementById('message-form').submit();"></textarea>
  </form>
{% endblock %}